package com.end;

import java.util.*;

public class Exam2 {

    public static void main(String[] args) {
        Map<String, List<String>> map = new HashMap<>();
        Map<String, List<String>> count = new HashMap<>();
        Scanner sc = new Scanner(System.in);
        for(int n = 0; n < 5; n++){
            String name = sc.next();
            sc.nextLine();
            String vote = sc.nextLine();
            List<String> test = List.of(vote.split("，"));
            map.put(name, test);
            for(String view : test){
                if(count.containsKey(view)){
                    count.get(view).add(name);
                }else{
                    List<String> temp = new ArrayList<>();
                    temp.add(name);
                    count.put(view, temp);
                }
            }
        }
        int max = 0;
        String maxLocation = null;
        for(Map.Entry<String, List<String>> entry : count.entrySet()){
            if(entry.getValue().size() > max){
                max = entry.getValue().size();
                maxLocation = entry.getKey();
            }
            System.out.println(entry.getKey() + "想去的人数是" + entry.getValue().size());
        }
        System.out.println("投票最多的地方是" + maxLocation);
        
    }


}
